package chances.epg.entity.content;

import java.math.BigDecimal;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class EpgContent {
	protected Long contentId;// 非唯一的,contentId + type唯一
	// 搜索条件
	protected String contentBaseType;// 内容类型
	protected String contentBaseTags;// 内容基础标签
	protected String contentOpTags;// 内容运营标签
	private String country;// 发行国家/地区;
	private String year;// 发行年份
	private String actors;// 演员
	private String director;// 导演
	private String compere;// 主持人
	private String searchName;// 首字母

	// 显示
	private String type;// vod:单集;series：连续剧;series2:系列剧
	protected String contentCode;
	protected String externalCode;
	protected String title;// 标题
	protected String subTitle;// 副标题
	protected String icon;
	protected String poster;// 竖图
	protected String still;// 横图
	protected String opImg1;// 运营图片1
	protected String opImg2;// 运营图片2
	protected String score;// 评分
	protected String showFlag;// 基础角标
	protected String opShowFlag;// 运营角标
	protected Integer hdType;//标清,高清,4K等
	

	protected List<Episode> episodes; // 多剧集子集集合
	
	public static final String SEARCH_GROUP = "group";
	public static final String SEARCH_GROUP_ALL = "all";

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getContentCode() {
		return contentCode;
	}

	public void setContentCode(String contentCode) {
		this.contentCode = contentCode;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSubTitle() {
		return subTitle;
	}

	public void setSubTitle(String subTitle) {
		this.subTitle = subTitle;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getPoster() {
		return poster;
	}

	public void setPoster(String poster) {
		this.poster = poster;
	}

	public String getStill() {
		return still;
	}

	public void setStill(String still) {
		this.still = still;
	}

	public String getOpImg1() {
		return opImg1;
	}

	public void setOpImg1(String opImg1) {
		this.opImg1 = opImg1;
	}

	public String getOpImg2() {
		return opImg2;
	}

	public void setOpImg2(String opImg2) {
		this.opImg2 = opImg2;
	}

	public String getScore() {
		return score;
	}

	public void setScore(String score) {
		this.score = score;
	}

	public String getContentBaseTags() {
		return contentBaseTags;
	}

	public void setContentBaseTags(String contentBaseTags) {
		this.contentBaseTags = contentBaseTags;
	}

	public String getContentOpTags() {
		return contentOpTags;
	}

	public void setContentOpTags(String contentOpTags) {
		this.contentOpTags = contentOpTags;
	}

	public String getShowFlag() {
		return showFlag;
	}

	public void setShowFlag(String showFlag) {
		this.showFlag = showFlag;
	}

	public String getOpShowFlag() {
		return opShowFlag;
	}

	public void setOpShowFlag(String opShowFlag) {
		this.opShowFlag = opShowFlag;
	}

	public String getExternalCode() {
		return externalCode;
	}

	public void setExternalCode(String externalCode) {
		this.externalCode = externalCode;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getYear() {
		return year;
	}

	public void setYear(String year) {
		this.year = year;
	}

	public String getActors() {
		return actors;
	}

	public void setActors(String actors) {
		this.actors = actors;
	}

	public String getDirector() {
		return director;
	}

	public void setDirector(String director) {
		this.director = director;
	}

	public String getCompere() {
		return compere;
	}

	public void setCompere(String compere) {
		this.compere = compere;
	}

	public String getSearchName() {
		return searchName;
	}

	public void setSearchName(String searchName) {
		this.searchName = searchName;
	}

	public Long getContentId() {
		return contentId;
	}

	public void setContentId(Long contentId) {
		this.contentId = contentId;
	}

	public String getContentBaseType() {
		return contentBaseType;
	}

	public void setContentBaseType(String contentBaseType) {
		this.contentBaseType = contentBaseType;
	}

	public String getSearchYear() {
		if (StringUtils.isBlank(this.year) || !StringUtils.isNumeric(this.year)) {
			return this.year;
		}

		BigDecimal year = new BigDecimal(this.year);

		if (year.compareTo(new BigDecimal(2010)) < 0) {
			return "2010";
		} else {
			return this.year;
		}

	}

	public float getScoreFloat() {
		if (StringUtils.isBlank(this.score)) {
			return 0;
		}

		try {
			BigDecimal bigDecimal = new BigDecimal(this.score);
			return bigDecimal.floatValue();
		} catch (Throwable ex) {

		}

		return 0;
	}

	public List<Episode> getEpisodes() {
		return episodes;
	}

	public void setEpisodes(List<Episode> episodes) {
		this.episodes = episodes;
	}

	public Integer getHdType() {
		return hdType;
	}

	public void setHdType(Integer hdType) {
		this.hdType = hdType;
	}
}
